/*
 * CreateMsgQue.c
 *
 *  Created on: Oct 19, 2012
 *      Author: lakshmana s


#include<stdio.h>
#include<mqueue.h>
#include<sys/stat.h>
#include<fcntl.h>
#include "MessageQueue.h"


int main(int argc,char *argv[]){

	int i=0;
	char *source="student";
	Msg_Node_t *newMsg =NULL;
	for(i=0;i<4;i++){
	Msg_t msg= (Msg_t) malloc(sizeof(Message));
	newMsg = (Msg_Node_t *)malloc(sizeof(Msg_Node_t));

	msg->source="student";
	msg->student_id=i;
	msg->student_name="student1";
	msg->advisor_id=100+i;
	msg->advisor_name="advisor1";
	msg->course_id=5334;
	msg->course_name="OS-2";
	msg->clearance=0;

	newMsg->request=msg;
	newMsg->next=NULL;
	newMsg->prev=NULL;


	addMsg(newMsg);
	}
	displayMsges();
	//saveMsges();
	//restoreMsges();
	//displayMsges();
	fetchMsg(source);
	return 1;
}
*/




/*
 * This is sample code generated by rpcgen.
 * These are only templates and you can use them
 * as a guideline for developing your own functions.
*/

#include "mq_interface.h"


void
mq_send_prog_1(char *host)
{
        CLIENT *clnt;
        int  *result_1;
        Msg_t  msg_1=(Msg_t)malloc(sizeof(Message));
        msg_1->source="student";
        msg_1->student_id=1;
        msg_1->student_name="student1";
        msg_1->course_id=5434;
        msg_1->course_name="OS-2";
        msg_1->clearance=0;

#ifndef DEBUG
        clnt = clnt_create (host, MQ_SEND_PROG, MQ_PROG_VERS, "udp");
        if (clnt == NULL) {
                clnt_pcreateerror (host);
                exit (1);
        }
#endif

        result_1 = sendmsg_1(&msg_1, clnt);
        if (result_1 == (int *) NULL) {
                clnt_perror (clnt, "call failed");
        }
#ifndef DEBUG
        clnt_destroy (clnt);
#endif
}


int
main (int argc, char *argv[])
{
        char *host;

        host = "localhost";
        mq_send_prog_1 (host);
exit (0);
}


